home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / qwatch / queues.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  13.8 KB  |  417 lines

  1. VERSION 2.00
  2. Begin Form Queues 
  3.    BackColor       =   &H00C0FFC0&
  4.    ClientHeight    =   4605
  5.    ClientLeft      =   1575
  6.    ClientTop       =   1590
  7.    ClientWidth     =   6060
  8.    Height          =   5010
  9.    Icon            =   0
  10.    Left            =   1515
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   4605
  14.    ScaleWidth      =   6060
  15.    Top             =   1245
  16.    Width           =   6180
  17.    Begin CommandButton Command1 
  18.       Caption         =   "OK"
  19.       Default         =   -1  'True
  20.       FontBold        =   -1  'True
  21.       FontItalic      =   0   'False
  22.       FontName        =   "MS Sans Serif"
  23.       FontSize        =   9.75
  24.       FontStrikethru  =   0   'False
  25.       FontUnderline   =   0   'False
  26.       Height          =   375
  27.       Left            =   2640
  28.       TabIndex        =   0
  29.       Top             =   4080
  30.       Width           =   855
  31.    End
  32.    Begin PictureBox Warning 
  33.       BackColor       =   &H008080FF&
  34.       Height          =   495
  35.       Index           =   4
  36.       Left            =   360
  37.       ScaleHeight     =   465
  38.       ScaleWidth      =   465
  39.       TabIndex        =   5
  40.       TabStop         =   0   'False
  41.       Top             =   3480
  42.       Width           =   495
  43.    End
  44.    Begin PictureBox Warning 
  45.       BackColor       =   &H008080FF&
  46.       Height          =   495
  47.       Index           =   3
  48.       Left            =   360
  49.       ScaleHeight     =   465
  50.       ScaleWidth      =   465
  51.       TabIndex        =   4
  52.       TabStop         =   0   'False
  53.       Top             =   2760
  54.       Width           =   495
  55.    End
  56.    Begin PictureBox Warning 
  57.       BackColor       =   &H008080FF&
  58.       Height          =   495
  59.       Index           =   2
  60.       Left            =   360
  61.       ScaleHeight     =   465
  62.       ScaleWidth      =   465
  63.       TabIndex        =   3
  64.       TabStop         =   0   'False
  65.       Top             =   2040
  66.       Width           =   495
  67.    End
  68.    Begin PictureBox Warning 
  69.       BackColor       =   &H008080FF&
  70.       Height          =   495
  71.       Index           =   1
  72.       Left            =   360
  73.       ScaleHeight     =   465
  74.       ScaleWidth      =   465
  75.       TabIndex        =   2
  76.       TabStop         =   0   'False
  77.       Top             =   1320
  78.       Width           =   495
  79.    End
  80.    Begin PictureBox Warning 
  81.       BackColor       =   &H008080FF&
  82.       Height          =   495
  83.       Index           =   0
  84.       Left            =   360
  85.       ScaleHeight     =   465
  86.       ScaleWidth      =   465
  87.       TabIndex        =   1
  88.       TabStop         =   0   'False
  89.       Top             =   600
  90.       Width           =   495
  91.    End
  92.    Begin Label Jobs 
  93.       Alignment       =   1  'Right Justify
  94.       FontBold        =   -1  'True
  95.       FontItalic      =   0   'False
  96.       FontName        =   "MS Sans Serif"
  97.       FontSize        =   9.75
  98.       FontStrikethru  =   0   'False
  99.       FontUnderline   =   0   'False
  100.       Height          =   255
  101.       Index           =   4
  102.       Left            =   5160
  103.       TabIndex        =   23
  104.       Top             =   3600
  105.       Width           =   495
  106.    End
  107.    Begin Label Status 
  108.       FontBold        =   -1  'True
  109.       FontItalic      =   0   'False
  110.       FontName        =   "MS Sans Serif"
  111.       FontSize        =   9.75
  112.       FontStrikethru  =   0   'False
  113.       FontUnderline   =   0   'False
  114.       Height          =   255
  115.       Index           =   4
  116.       Left            =   3960
  117.       TabIndex        =   17
  118.       Top             =   3600
  119.       Width           =   975
  120.    End
  121.    Begin Label QueueName 
  122.       FontBold        =   -1  'True
  123.       FontItalic      =   0   'False
  124.       FontName        =   "MS Sans Serif"
  125.       FontSize        =   9.75
  126.       FontStrikethru  =   0   'False
  127.       FontUnderline   =   0   'False
  128.       Height          =   255
  129.       Index           =   4
  130.       Left            =   1200
  131.       TabIndex        =   11
  132.       Top             =   3600
  133.       Width           =   2535
  134.    End
  135.    Begin Label Jobs 
  136.       Alignment       =   1  'Right Justify
  137.       FontBold        =   -1  'True
  138.       FontItalic      =   0   'False
  139.       FontName        =   "MS Sans Serif"
  140.       FontSize        =   9.75
  141.       FontStrikethru  =   0   'False
  142.       FontUnderline   =   0   'False
  143.       Height          =   255
  144.       Index           =   3
  145.       Left            =   5160
  146.       TabIndex        =   22
  147.       Top             =   2880
  148.       Width           =   495
  149.    End
  150.    Begin Label Status 
  151.       FontBold        =   -1  'True
  152.       FontItalic      =   0   'False
  153.       FontName        =   "MS Sans Serif"
  154.       FontSize        =   9.75
  155.       FontStrikethru  =   0   'False
  156.       FontUnderline   =   0   'False
  157.       Height          =   255
  158.       Index           =   3
  159.       Left            =   3960
  160.       TabIndex        =   16
  161.       Top             =   2880
  162.       Width           =   975
  163.    End
  164.    Begin Label QueueName 
  165.       FontBold        =   -1  'True
  166.       FontItalic      =   0   'False
  167.       FontName        =   "MS Sans Serif"
  168.       FontSize        =   9.75
  169.       FontStrikethru  =   0   'False
  170.       FontUnderline   =   0   'False
  171.       Height          =   255
  172.       Index           =   3
  173.       Left            =   1200
  174.       TabIndex        =   10
  175.       Top             =   2880
  176.       Width           =   2535
  177.    End
  178.    Begin Label Jobs 
  179.       Alignment       =   1  'Right Justify
  180.       FontBold        =   -1  'True
  181.       FontItalic      =   0   'False
  182.       FontName        =   "MS Sans Serif"
  183.       FontSize        =   9.75
  184.       FontStrikethru  =   0   'False
  185.       FontUnderline   =   0   'False
  186.       Height          =   255
  187.       Index           =   2
  188.       Left            =   5160
  189.       TabIndex        =   21
  190.       Top             =   2160
  191.       Width           =   495
  192.    End
  193.    Begin Label Status 
  194.       FontBold        =   -1  'True
  195.       FontItalic      =   0   'False
  196.       FontName        =   "MS Sans Serif"
  197.       FontSize        =   9.75
  198.       FontStrikethru  =   0   'False
  199.       FontUnderline   =   0   'False
  200.       Height          =   255
  201.       Index           =   2
  202.       Left            =   3960
  203.       TabIndex        =   15
  204.       Top             =   2160
  205.       Width           =   975
  206.    End
  207.    Begin Label QueueName 
  208.       FontBold        =   -1  'True
  209.       FontItalic      =   0   'False
  210.       FontName        =   "MS Sans Serif"
  211.       FontSize        =   9.75
  212.       FontStrikethru  =   0   'False
  213.       FontUnderline   =   0   'False
  214.       Height          =   255
  215.       Index           =   2
  216.       Left            =   1200
  217.       TabIndex        =   9
  218.       Top             =   2160
  219.       Width           =   2535
  220.    End
  221.    Begin Label Jobs 
  222.       Alignment       =   1  'Right Justify
  223.       FontBold        =   -1  'True
  224.       FontItalic      =   0   'False
  225.       FontName        =   "MS Sans Serif"
  226.       FontSize        =   9.75
  227.       FontStrikethru  =   0   'False
  228.       FontUnderline   =   0   'False
  229.       Height          =   255
  230.       Index           =   1
  231.       Left            =   5160
  232.       TabIndex        =   20
  233.       Top             =   1440
  234.       Width           =   495
  235.    End
  236.    Begin Label Status 
  237.       FontBold        =   -1  'True
  238.       FontItalic      =   0   'False
  239.       FontName        =   "MS Sans Serif"
  240.       FontSize        =   9.75
  241.       FontStrikethru  =   0   'False
  242.       FontUnderline   =   0   'False
  243.       Height          =   255
  244.       Index           =   1
  245.       Left            =   3960
  246.       TabIndex        =   14
  247.       Top             =   1440
  248.       Width           =   975
  249.    End
  250.    Begin Label QueueName 
  251.       FontBold        =   -1  'True
  252.       FontItalic      =   0   'False
  253.       FontName        =   "MS Sans Serif"
  254.       FontSize        =   9.75
  255.       FontStrikethru  =   0   'False
  256.       FontUnderline   =   0   'False
  257.       Height          =   255
  258.       Index           =   1
  259.       Left            =   1200
  260.       TabIndex        =   8
  261.       Top             =   1440
  262.       Width           =   2535
  263.    End
  264.    Begin Label Jobs 
  265.       Alignment       =   1  'Right Justify
  266.       FontBold        =   -1  'True
  267.       FontItalic      =   0   'False
  268.       FontName        =   "MS Sans Serif"
  269.       FontSize        =   9.75
  270.       FontStrikethru  =   0   'False
  271.       FontUnderline   =   0   'False
  272.       Height          =   255
  273.       Index           =   0
  274.       Left            =   5160
  275.       TabIndex        =   19
  276.       Top             =   720
  277.       Width           =   495
  278.    End
  279.    Begin Label Status 
  280.       FontBold        =   -1  'True
  281.       FontItalic      =   0   'False
  282.       FontName        =   "MS Sans Serif"
  283.       FontSize        =   9.75
  284.       FontStrikethru  =   0   'False
  285.       FontUnderline   =   0   'False
  286.       Height          =   255
  287.       Index           =   0
  288.       Left            =   3960
  289.       TabIndex        =   13
  290.       Top             =   720
  291.       Width           =   975
  292.    End
  293.    Begin Label QueueName 
  294.       BackColor       =   &H00FFFFFF&
  295.       FontBold        =   -1  'True
  296.       FontItalic      =   0   'False
  297.       FontName        =   "MS Sans Serif"
  298.       FontSize        =   9.75
  299.       FontStrikethru  =   0   'False
  300.       FontUnderline   =   0   'False
  301.       ForeColor       =   &H00FF0000&
  302.       Height          =   255
  303.       Index           =   0
  304.       Left            =   1200
  305.       TabIndex        =   7
  306.       Top             =   720
  307.       Width           =   2535
  308.    End
  309.    Begin Label Label13 
  310.       BackColor       =   &H00FF0000&
  311.       Caption         =   "Jobs"
  312.       FontBold        =   -1  'True
  313.       FontItalic      =   0   'False
  314.       FontName        =   "MS Sans Serif"
  315.       FontSize        =   9.75
  316.       FontStrikethru  =   0   'False
  317.       FontUnderline   =   -1  'True
  318.       ForeColor       =   &H00FFFFFF&
  319.       Height          =   255
  320.       Left            =   5145
  321.       TabIndex        =   18
  322.       Top             =   240
  323.       Width           =   540
  324.    End
  325.    Begin Label Label7 
  326.       BackColor       =   &H00FF0000&
  327.       Caption         =   "Status"
  328.       FontBold        =   -1  'True
  329.       FontItalic      =   0   'False
  330.       FontName        =   "MS Sans Serif"
  331.       FontSize        =   9.75
  332.       FontStrikethru  =   0   'False
  333.       FontUnderline   =   -1  'True
  334.       ForeColor       =   &H00FFFFFF&
  335.       Height          =   255
  336.       Left            =   3960
  337.       TabIndex        =   12
  338.       Top             =   240
  339.       Width           =   735
  340.    End
  341.    Begin Label Label1 
  342.       BackColor       =   &H00FF0000&
  343.       Caption         =   "Queue"
  344.       FontBold        =   -1  'True
  345.       FontItalic      =   0   'False
  346.       FontName        =   "MS Sans Serif"
  347.       FontSize        =   9.75
  348.       FontStrikethru  =   0   'False
  349.       FontUnderline   =   -1  'True
  350.       ForeColor       =   &H00FFFFFF&
  351.       Height          =   255
  352.       Left            =   1200
  353.       TabIndex        =   6
  354.       Top             =   240
  355.       Width           =   735
  356.    End
  357. Sub Command1_Click ()
  358.     '*----------*
  359.     'close window
  360.     '*----------*
  361.     Unload Queues
  362. End Sub
  363. Sub Form_Load ()
  364.     Static Share(49) As Share_Info
  365.     Dim Queue As PRQJINFO
  366.     Dim nEntries As Integer, nTotal As Integer, nNeeded As Integer
  367.     Dim nResult As Integer, nQueue, nShare As Integer, nQueueWarning
  368.     Dim szServer As String
  369.     '*---------------------------------------------------*
  370.     'query specified server for a list of shared resources
  371.     '*---------------------------------------------------*
  372.     Queues.Caption = QWatch.Server.Text
  373.     szServer = "\\" + QWatch.Server.Text + ""
  374.     nResult = NetShareEnum(szServer, 2, Share(0), 2000, nEntries, nTotal)
  375.     nQueue = 0
  376.     For nShare = 0 To nEntries
  377.         If Share(nShare).nType = 1 Then
  378.             '*------------------------------------------------------*
  379.             'if shared resource is a print queue then get information
  380.             '*------------------------------------------------------*
  381.             nResult = DosPrintQGetInfo(szServer, Share(nShare).lpPath, 1, Queue, 115, nNeeded)
  382.             '*------------------------------------------------------------*
  383.             'assign queue information to the elements in the control arrays
  384.             '*------------------------------------------------------------*
  385.             nQueueWarning = 0
  386.             QueueName(nQueue).Caption = Share(nShare).szName
  387.             Status(nQueue).Caption = "Idle"
  388.             Jobs(nQueue).Caption = Str$(Queue.nJobs)
  389.             '*-----------------------------------*
  390.             'determine warning level for the queue
  391.             '*-----------------------------------*
  392.             If Queue.nStatus = 64 Then
  393.                 nQueueWarning = 1
  394.                 Status(nQueue).Caption = "Paused"
  395.             ElseIf Queue.nStatus = 32 Then
  396.                 nQueueWarning = 2
  397.                 Status(nQueue).Caption = "Offline"
  398.                 ElseIf Queue.nJobs Then
  399.                     If Queue.nJobs >= Val(QWatch.YellowLevel.Text) Then nQueueWarning = 1
  400.                     If Queue.nJobs >= Val(QWatch.RedLevel.Text) Then nQueueWarning = 2
  401.                 End If
  402.             '*--------------------------------------------------*
  403.             'establish appropriate icon in the icon control array
  404.             '*--------------------------------------------------*
  405.             Select Case nQueueWarning
  406.                 Case 0
  407.                     Warning(nQueue).Picture = QWatch.Green.Picture
  408.                 Case 1
  409.                     Warning(nQueue).Picture = QWatch.Yellow.Picture
  410.                 Case 2
  411.                     Warning(nQueue).Picture = QWatch.Red.Picture
  412.             End Select
  413.             nQueue = nQueue + 1
  414.         End If
  415.     Next
  416. End Sub
  417.